local mansi = fk.CreateSkill {

  name = "joy__mansi",

  tags = {  },

}



mansi:addEffect("viewas", {
  name = "joy__mansi",
  anim_type = "offensive",
  prompt = "#mansi",
  card_filter = Util.FalseFunc,
  view_as = function(self, player,cards)
    local card = Fk:cloneCard("savage_assault")
    card:addSubcards(player:getCardIds(Player.Hand))
    card.skillName = mansi.name
    return card
  end,
  enabled_at_play = function(self, player)
    return player:usedSkillTimes(mansi.name, Player.HistoryPhase) == 0 and not player:isKongcheng()
  end,
})

mansi:addEffect(fk.Damaged, {
  name = "#joy__mansi_trigger",
  events = {fk.Damaged},
  mute = true,
  --mansi,
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill("joy__mansi") and data.card and data.card.trueName == "savage_assault"
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:drawCards(1, "@joy__mansi")
    player:broadcastSkillInvoke("joy__mansi")
    room:notifySkillInvoked(player, "joy__mansi", "drawcard")
    room:addPlayerMark(player, "@joy__mansi", 1)
    room.logic:trigger("fk.joy_mansi", player, { num = player:getMark("@joy_mansi")})
  end,
})

return mansi